/**
 * 
 */
package wayic.utils;

/**
 * @author Pihu
 *
 */
public class SearchUtils {

    /**
     * 
     */
    private SearchUtils() {}
    
    public static String friendlyName(String host) {
        if(host == null){
            return null;
        }
        String friendlyHost = host
            .replaceAll("www\\.", "")
            .replaceAll("ww\\.", "")
            .replaceAll("en\\.", "")
            .replaceAll("\\.com", "")
            .replaceAll("\\.org", "")
            .replaceAll("\\.net", "")
            .replaceAll("\\.fm", "")
            .replaceAll("\\.tv", "")
            .replaceAll("\\.mobi", "")
            .replaceAll("\\.ws", "")
            .replaceAll("\\.cc", "");
        int dot = friendlyHost.indexOf(".");
        if(dot != -1){
            friendlyHost = friendlyHost.substring(dot + 1);
        }
        return friendlyHost;
    }

}
